<%--
  Created by IntelliJ IDEA.
  User: qiliping
  Date: 15/12/16
  Time: 下午5:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>


<html>
<head>
    <title>编辑后台权限点</title>
    <script>
        $(function(){
            $("#model").change(function(){
                var model = $(this).val();
                if(model>0){
                    $.ajax({
                        url:"${ctx}/sys/permissions/get_menu_by_model",
                        type:"POST",
                        dataType:"json",
                        data:{modelId:model},
                        success:function(res){

                            $("#menu").html('<option value="0">--一级菜单--</option>');
                            $(res).each(function(r){
                                $("#menu").append('<option value="'+ res[r].sysPermissionId+'">'+ res[r].name+'</option>')
                            })
                        }
                    })
                }
            })
        })
    </script>
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            后台权限点管理
            <small>编辑后台权限点</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="${ctx}/main">
                    首页
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="${ctx}/sys/permissions_list">
                    后台权限点管理
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="#">

                    编辑后台权限点
                </a>
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<div class="main">

    <div class="row">
        <div class="col-md-12">
            <form:form modelAttribute="PermissionsAddModel" method="post" class="form-horizontal">
                <form:hidden path="id"></form:hidden>
                <div class="form-body">
                    <div class="form-group">
                        <label class="control-label col-md-3">名称：</label>
                        <div class="col-md-4">
                            <form:input path="name" cssClass="form-control" placeholder=""></form:input>
                        </div>
                        <form:errors path="name" cssClass="field-validation-error" element="div"></form:errors>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">权限标识：</label>
                        <div class="col-md-4">
                            <form:input path="key" cssClass="form-control" placeholder=""></form:input>
                        </div>
                        <form:errors path="key" cssClass="field-validation-error" element="div"></form:errors>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">链接：</label>
                        <div class="col-md-4">
                            <form:input path="url" cssClass="form-control" placeholder=""></form:input>
                        </div>
                        <form:errors path="url" cssClass="field-validation-error" element="div"></form:errors>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">所属模块：</label>

                        <div class="col-md-4">
                            <form:select path="model" class="form-control js-roleSelect">
                                <form:option value="0">--一级模块--</form:option>
                                <form:options items="${modelList}" itemValue="sysPermissionId"
                                              itemLabel="name"/>
                            </form:select>
                        </div>
                        <form:errors path="model" cssClass="field-validation-error" element="div"></form:errors>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-md-3">所属菜单：</label>

                        <div class="col-md-4">
                            <form:select path="menu" class="form-control js-roleSelect">

                                <form:option value="0">--一级菜单--</form:option>
                                <form:options items="${menuList}" itemValue="sysPermissionId"
                                              itemLabel="name"/>
                            </form:select>
                        </div>
                        <form:errors path="menu" cssClass="field-validation-error" element="div"></form:errors>
                    </div>


                    <div class="form-group">
                        <div class="col-md-9 col-md-offset-3 ">
                            <input type="submit" value="提交" class="btn green"/>
                            <a href="${ctx}/sys/permissions_list" class="btn btn-default">取消</a>
                        </div>
                    </div>
                </div>

            </form:form>
        </div>
    </div>



</div>
</body>
</html>
